{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Title: #Check If Two String Arrays are Equivalent"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Difficulty: #Easy"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Category Title: #Algorithms"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Tag Slug: #array #string"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Name Translated: #数组 #字符串"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Solution Name: arrayStringsAreEqual"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Translated Title: #检查两个字符串数组是否相等"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Translated Content:\n",
    "<p>给你两个字符串数组 <code>word1</code> 和 <code>word2</code> 。如果两个数组表示的字符串相同，返回<em> </em><code>true</code><em> </em>；否则，返回 <code>false</code><em> 。</em></p>\n",
    "\n",
    "<p><strong>数组表示的字符串</strong> 是由数组中的所有元素 <strong>按顺序</strong> 连接形成的字符串。</p>\n",
    "\n",
    "<p> </p>\n",
    "\n",
    "<p><strong>示例 1：</strong></p>\n",
    "\n",
    "<pre>\n",
    "<strong>输入：</strong>word1 = [\"ab\", \"c\"], word2 = [\"a\", \"bc\"]\n",
    "<strong>输出：</strong>true\n",
    "<strong>解释：</strong>\n",
    "word1 表示的字符串为 \"ab\" + \"c\" -> \"abc\"\n",
    "word2 表示的字符串为 \"a\" + \"bc\" -> \"abc\"\n",
    "两个字符串相同，返回 true</pre>\n",
    "\n",
    "<p><strong>示例 2：</strong></p>\n",
    "\n",
    "<pre>\n",
    "<strong>输入：</strong>word1 = [\"a\", \"cb\"], word2 = [\"ab\", \"c\"]\n",
    "<strong>输出：</strong>false\n",
    "</pre>\n",
    "\n",
    "<p><strong>示例 3：</strong></p>\n",
    "\n",
    "<pre>\n",
    "<strong>输入：</strong>word1  = [\"abc\", \"d\", \"defg\"], word2 = [\"abcddefg\"]\n",
    "<strong>输出：</strong>true\n",
    "</pre>\n",
    "\n",
    "<p> </p>\n",
    "\n",
    "<p><strong>提示：</strong></p>\n",
    "\n",
    "<ul>\n",
    "\t<li><code>1 <= word1.length, word2.length <= 10<sup>3</sup></code></li>\n",
    "\t<li><code>1 <= word1[i].length, word2[i].length <= 10<sup>3</sup></code></li>\n",
    "\t<li><code>1 <= sum(word1[i].length), sum(word2[i].length) <= 10<sup>3</sup></code></li>\n",
    "\t<li><code>word1[i]</code> 和 <code>word2[i]</code> 由小写字母组成</li>\n",
    "</ul>\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Description: [check-if-two-string-arrays-are-equivalent](https://leetcode.cn/problems/check-if-two-string-arrays-are-equivalent/description/)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Solutions: [check-if-two-string-arrays-are-equivalent](https://leetcode.cn/problems/check-if-two-string-arrays-are-equivalent/solutions/)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "test_cases = ['[\"ab\", \"c\"]\\n[\"a\", \"bc\"]', '[\"a\", \"cb\"]\\n[\"ab\", \"c\"]', '[\"abc\", \"d\", \"defg\"]\\n[\"abcddefg\"]']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        a = ''\n",
    "        for i in range(len(word1)):\n",
    "            a += word1[i]\n",
    "        b = ''\n",
    "        for j in range(len(word2)):\n",
    "            b += word2[j]\n",
    "        return a == b"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        str1 =\"\"\n",
    "        str2 = \"\"\n",
    "        for i in word1:\n",
    "            str1 += i\n",
    "        for j in word2:\n",
    "            str2 += j\n",
    "        return str1 == str2\n",
    "\n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "         return ''.join(word1) == ''.join(word2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        chain1 = chain.from_iterable(word1)\n",
    "        chain2 = chain.from_iterable(word2)\n",
    "        for c1, c2 in zip_longest(chain1, chain2):\n",
    "            if c1 != c2:\n",
    "                return False\n",
    "        return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        return ''.join(word1) == ''.join(word2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        return \"\".join(word1) == \"\".join(word2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]):\n",
    "        return ''.join(word1) == ''.join(word2)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        return ''.join(word1) == ''.join(word2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        return ''.join(word1) == ''.join(word2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        w1=''\n",
    "        w2=''\n",
    "        for i in range(len(word1)):\n",
    "            w1+=word1[i]\n",
    "        for i in range(len(word2)):\n",
    "            w2+=word2[i]\n",
    "        return w1==w2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        p1 = p2 = i = j = 0\n",
    "        while p1 < len(word1) and p2 < len(word2):\n",
    "            if word1[p1][i] != word2[p2][j]:\n",
    "                return False\n",
    "            i += 1\n",
    "            if i == len(word1[p1]):\n",
    "                p1 += 1\n",
    "                i = 0\n",
    "            j += 1\n",
    "            if j == len(word2[p2]):\n",
    "                p2 += 1\n",
    "                j = 0\n",
    "        return p1 == len(word1) and p2 == len(word2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        return ''.join(word1) == ''.join(word2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        return \"\".join(word1)==\"\".join(word2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        x1,x2 = '', ''\n",
    "        for n1 in word1:\n",
    "            x1 += n1\n",
    "        for n2 in word2:\n",
    "            x2 += n2\n",
    "        return x1 == x2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        return \"\".join(word1) == \"\".join(word2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        return ''.join(word1) == ''.join(word2)\n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        str1 = ''.join(word1)\n",
    "        str2 = ''.join(word2)\n",
    "        return str1 == str2;"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        a = word1[0]\n",
    "        for word in word1[1:]:\n",
    "            a += word\n",
    "        b = word2[0]\n",
    "        for word in word2[1:]:\n",
    "            b += word\n",
    "        if a==b:\n",
    "            return True\n",
    "        return False"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "      l1=len(word1)\n",
    "      l2=len(word2)\n",
    "      s1=word1[0]\n",
    "      s2=word2[0]\n",
    "      for i in range(1,l1):\n",
    "        s1+=word1[i]\n",
    "      for j in range(1,l2):\n",
    "        s2+=word2[j] \n",
    "      if s1==s2:\n",
    "        return True\n",
    "      return False"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        return ''.join(word1) == ''.join(word2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        return ''.join(word1) == ''.join(word2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        chain1 = chain.from_iterable(word1)\n",
    "        chain2 = chain.from_iterable(word2)\n",
    "        for c1, c2 in zip_longest(chain1, chain2):\n",
    "            if c1 != c2:\n",
    "                return False\n",
    "        return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        return ''.join(word1) == ''.join(word2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        return \"\".join(word1) == \"\".join(word2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        return bool( 1 if \"\".join(word1) == \"\".join(word2) else 0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        w1=''\n",
    "        for word in word1:\n",
    "            w1+=word\n",
    "        w2=''\n",
    "        for word in word2:\n",
    "            w2+=word\n",
    "        return w1==w2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        return ''.join(word1) == ''.join(word2)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "            word1 = ''.join(word1)\n",
    "            word2 = ''.join(word2)\n",
    "            if word1 == word2:\n",
    "                return True\n",
    "            return False"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "from typing import List\n",
    "\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        return \"\".join(word1) == \"\".join(word2)\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        s_word1 = ''.join(word1)\n",
    "        s_word2 = ''.join(word2)\n",
    "        return s_word1==s_word2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        return ''.join(word1) == ''.join(word2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        oneIndex = oneCurrIndex = twoIndex = twoCurrIndex = 0\n",
    "        while oneIndex < len(word1) and twoIndex < len(word2):\n",
    "            if word1[oneIndex][oneCurrIndex] != word2[twoIndex][twoCurrIndex]:\n",
    "                return False\n",
    "\n",
    "            oneCurrIndex += 1\n",
    "            if oneCurrIndex == len(word1[oneIndex]):\n",
    "                oneIndex += 1\n",
    "                oneCurrIndex = 0\n",
    "\n",
    "            twoCurrIndex += 1\n",
    "            if twoCurrIndex == len(word2[twoIndex]):\n",
    "                twoIndex += 1\n",
    "                twoCurrIndex = 0\n",
    "\n",
    "        return oneIndex == len(word1) and twoIndex == len(word2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        return ''.join(word1) == ''.join(word2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        p1 = p2 = i = j = 0\n",
    "        while p1 < len(word1) and p2 < len(word2):\n",
    "            if word1[p1][i] != word2[p2][j]:\n",
    "                return False\n",
    "            i += 1\n",
    "            if i == len(word1[p1]):\n",
    "                p1 += 1\n",
    "                i = 0\n",
    "            j += 1\n",
    "            if j == len(word2[p2]):\n",
    "                p2 += 1\n",
    "                j = 0\n",
    "        return p1 == len(word1) and p2 == len(word2)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        str1 = ''.join(word1)\n",
    "        str2 = ''.join(word2)\n",
    "        return str1 == str2\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        ans1 = \"\".join(word1)\n",
    "        ans2 = \"\".join(word2)\n",
    "        return ans1 == ans2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "\n",
    "        return ''.join(word1) == ''.join(word2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        return ''.join(word1) == ''.join(word2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        word1 = ''.join(word1)\n",
    "        word2 = ''.join(word2)\n",
    "        return word1 == word2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        str1 = \"\"\n",
    "        str2 = \"\"\n",
    "        for i in range(0,len(word1)):\n",
    "            str1 += word1[i]\n",
    "        for j in range(0,len(word2)):\n",
    "            str2 += word2[j]\n",
    "        if str1 == str2:\n",
    "            return True\n",
    "        else:\n",
    "            return False\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        a = \"\"\n",
    "        b = \"\"\n",
    "        for j in word1:\n",
    "            a = a + j\n",
    "        for i in word2:\n",
    "            b = b + i\n",
    "        if a == b:\n",
    "            return True\n",
    "        else:\n",
    "            return False"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        return \"\".join(word1) == \"\".join(word2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        return reduce(lambda x, y: x + y, word1) == reduce(lambda x, y: x + y, word2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        return \"\".join(word1)==\"\".join(word2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "              return \"\".join(word1)==\"\".join(word2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        return ''.join(word1) == ''.join(word2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        return \"\".join(word1) == \"\".join(word2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        return ''.join(word1) == ''.join(word2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "            if \"\".join(word1) == \"\".join(word2):\n",
    "                return True\n",
    "            return False"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        str1 = ''.join(word1)\n",
    "        str2 = ''.join(word2)\n",
    "        if str1 == str2:\n",
    "            return True\n",
    "        else:\n",
    "            return False"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        return \"\".join(word1) == \"\".join(word2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        res1=''\n",
    "        res2=''\n",
    "        for word in word1:\n",
    "            res1=res1+word\n",
    "        for word in word2:\n",
    "            res2=res2+word\n",
    "        return res1==res2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        return ''.join(word1)==''.join(word2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        return \"\".join(word1) == \"\".join(word2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        return \"\".join(word1) == \"\".join(word2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        return \"\".join(word1) == \"\".join(word2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        s1 = \"\"\n",
    "        for w in word1:\n",
    "            s1 = s1 + w\n",
    "        \n",
    "        s2 = \"\"\n",
    "        for w in word2:\n",
    "            s2 = s2 + w\n",
    "        \n",
    "        return s1 == s2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        emp1,emp2 = '',''\n",
    "        for i in word1:\n",
    "            emp1 += i\n",
    "        for j in word2:\n",
    "            emp2 += j\n",
    "        if emp1 == emp2:\n",
    "            return True\n",
    "        else:\n",
    "            return False\n",
    "            \n",
    "            "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        s1 = s2 = ''\n",
    "        for word in word1:\n",
    "            s1 += word\n",
    "        for word in word2:\n",
    "            s2 += word\n",
    "        return s1 == s2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        n1=len(word1)\n",
    "        n2=len(word2)\n",
    "        wo1=\"\"\n",
    "        wo2=\"\"\n",
    "        for i in range(n1):\n",
    "            wo1=wo1+word1[i]\n",
    "        for i in range(n2):\n",
    "            wo2=wo2+word2[i]\n",
    "        return wo1==wo2 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        return ''.join(word1) == ''.join(word2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "      return \"\".join(word1) == \"\".join(word2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        res1=''\n",
    "        res2=''\n",
    "        for word in word1:\n",
    "            res1=res1+word\n",
    "        for word in word2:\n",
    "            res2=res2+word\n",
    "        return res1==res2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        if word1[0][0] != word2[0][0]:\n",
    "            return False\n",
    "        return \"\".join(word1) == \"\".join(word2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        return ''.join(word1) == ''.join(word2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        if ''.join(word1)==''.join(word2):\n",
    "            return True\n",
    "        else:\n",
    "            return False "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        return ''.join(word1)==''.join(word2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        return ''.join(word1) == ''.join(word2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        for i in range(1, len(word1)):\n",
    "            if i == 0:\n",
    "                continue\n",
    "            else:\n",
    "                word1[0] += word1[i]\n",
    "\n",
    "        for i in range(1, len(word2)):\n",
    "            if i == 0:\n",
    "                continue\n",
    "            else:\n",
    "                word2[0] += word2[i]\n",
    "\n",
    "        if word1[0] == word2[0]:\n",
    "            return True\n",
    "        else:\n",
    "            return False"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        l1 = len(word1)\n",
    "        l2 = len(word2)\n",
    "        a = ''\n",
    "        b = ''\n",
    "        for i in range(0,l1):\n",
    "            a += word1[i]\n",
    "        for s in range(0,l2):\n",
    "            b += word2[s]\n",
    "        if a == b:\n",
    "            return True\n",
    "        else:\n",
    "            return False"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        '''\n",
    "        s1 = s2 = ''\n",
    "        for word in word1:\n",
    "            s1 += word\n",
    "        for word in word2:\n",
    "            s2 += word\n",
    "        return s1 == s2\n",
    "        '''\n",
    "\n",
    "        return ''.join(word1) == ''.join(word2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        return \"\".join(word1)==\"\".join(word2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        return ''.join(word1) == ''.join(word2)  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        res1 = \"\"\n",
    "        res2 = \"\"\n",
    "        for i in word1:\n",
    "            res1 = res1+i\n",
    "        for i in word2:\n",
    "            res2 = res2+i\n",
    "        return res1==res2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:\n",
    "        return ''.join(word1) == ''.join(word2)"
   ]
  }
 ],
 "metadata": {},
 "nbformat": 4,
 "nbformat_minor": 2
}
